package com.lightsaber.trade.cloth.dao.planning;

import java.util.List;

import org.springframework.stereotype.Component;

import com.lightsaber.trade.core.dao.BaseDao;
import com.lightsaber.trade.cloth.entity.planning.Level2DisciplineStatus;
import com.lightsaber.trade.cloth.entity.planning.PlanningStatus;

@Component
public class Level2DisciplineStatusDao extends BaseDao<Level2DisciplineStatus, String> {

    public Level2DisciplineStatus findDisciplineStatus(final String level2PlanningId,
            final String discipline, final String categoryNodeId) {
        eq("level2Planning.id", level2PlanningId);
        eq("discipline", discipline);
        eq("categoryNode.id", categoryNodeId);
        return unique();
    }

    public List<Level2DisciplineStatus> findByLevel2IdAndNodeid(final String level2PlanningId,
            final String categoryNodeId) {
        eq("level2Planning.id", level2PlanningId);
        eq("categoryNode.id", categoryNodeId);
        return list();
    }

    public List<Level2DisciplineStatus> checkAllDisciplineIsNotRejectByLevel2Id(
            final String level2PlanningId) {
        eq("level2Planning.id", level2PlanningId);
        eq("status", PlanningStatus.Rejected);
        return list();
    }
}
